using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NCS.Module.CMS.Library.Distributions;
using NCS.Module.CMS.Library.Comments;

namespace NCS.Module.CMS.Web.HomePage
{
    public partial class ListComment : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    int distid = int.Parse(Request.QueryString["distid"]);
                    DistributionInfo _Distribution;
                    _Distribution = DistributionController.GetDistribution(distid);
                    int contentid = 0;
                    if (_Distribution != null)
                    {
                        contentid = _Distribution.Distribution_ContentID;
                        DataTable dtComments = CommentDB.GetByContentID(contentid, true, 10);
                        grdComment.DataSource = dtComments;
                        grdComment.DataBind();

                        if (grdComment.Rows.Count == 0) this.Visible = false;
                    }
                }
                catch
                {
                    return;
                }

            }
        }
    }
}